#
#  "$Id: Makefile 2125 2017-11-13 14:59:07Z huangqianfeng $"
#
#  Copyright (c)2017-2027, ZheJiang Detu Network CO.LTD.
#  All Rights Reserved.
#
#	Description:	
#	Revisions:		Year-Month-Day  SVN-Author  Modification

OSA_MODULE_NAME := DT_DSP_DEMO

CONFIG_HI_CROSS := /opt/hisi-linux/x86-arm/aarch64-himix100-linux/bin/aarch64-himix100-linux-


#Define Makefile Compiler ToolChain
CPP	    = @echo " $(CONFIG_HI_CROSS)g++ $@"; $(CONFIG_HI_CROSS)g++
CC	    = @echo " $(CONFIG_HI_CROSS)gcc $@"; $(CONFIG_HI_CROSS)gcc
TOOL_CC = gcc
LD	    = @echo " $(CONFIG_HI_CROSS)ld  $@"; $(CONFIG_HI_CROSS)ld
AR  	= @echo " $(CONFIG_HI_CROSS)ar  $@"; $(CONFIG_HI_CROSS)ar
RM	    = @echo " RM	$@"; rm -rf
STRIP	= @echo " $(CONFIG_HI_CROSS)strip  $@"; $(CONFIG_HI_CROSS)strip


BASE_HOME := ./../../output
BASE_DT_HOME := ./../
#define Include Path 
#INC_THIRDPARTY_PATH             := $(BASE_HOME)/thirdparty/Inc/
#INC_ALG_PATH                := $(BASE_HOME)/Inc/Alg
#INC_HISI_PATH               := $(BASE_HOME)/Inc/Hisi

INC_ALG_PATH                := $(BASE_DT_HOME)/inc/
INC_HISI_PATH               := $(BASE_HOME)/include/hisi
INC_THIRDPARTY_PATH         := $(BASE_HOME)//include/

#define Demo Source File
DEMO      += .
SRC       += $(DEMO)/Demo.c
OBJS      += $(DEMO)/Demo.o 

#define Complier CFlags
CFLAGS  += -I $(INC_ALG_PATH) -I $(INC_HISI_PATH) -I $(INC_THIRDPARTY_PATH) -I../src/
CFLAGS  += -Wall -Wcast-align -Wcast-qual -Wsign-compare
CFLAGS  += -O3  
CFLAGS  += -g
#CFLAGS  += -lm
CFLAGS  += -mcpu=cortex-a53 
CFLAGS  += -fPIC
CFLAGS  += -fno-aggressive-loop-optimizations -ldl -ffunction-sections -fdata-sections 
AFLAGS  += -r
#-lsns_imx299 -lsns_imx299_slvs
#define Detu DSP Shared Library
LD_DTDSP_LIB_PATH = $(BASE_HOME)/lib/hisi
LD_DTDSP_LIB_NAME_S   += -lmpi_photo
LD_DTDSP_LIB_NAME_S   += -lmfnr_ap
LD_DTDSP_LIB_NAME_S   += -ldetail_ap
LD_DTDSP_LIB_NAME_S   += -lsfnr_ap
LD_DTDSP_LIB_NAME_S   += -lhdr_ap
LD_DTDSP_LIB_NAME_S   += -lsecurec_xml_ap
LD_DTDSP_LIB_NAME_S   += -lmpi
LD_DTDSP_LIB_NAME_S   += -lmpi_photo
LD_DTDSP_LIB_NAME_S   += -lisp -ldsp -l_hiae -l_hiawb -l_hidehaze  -laacdec  
LD_DTDSP_LIB_NAME_S   += -laacenc -ldnvqe -lhdmi -lhifisheyecalibrate  -lsns_imx477 -lsns_imx290 -lsns_imx334 -lsns_imx334_slave -lsns_imx277_slvs  
LD_DTDSP_LIB_NAME_S   += -lhive_record -lhive_RES
LD_DTDSP_LIB_NAME_S   += -ltde -lupvqe -lVoiceEngine  -l_hildci -l_hidrc 
LD_DTDSP_LIB_NAME_S   += -lsecurec -lpthread

#define thirdparty Shared Library
LD_THIRD_LIB_PATH  += $(BASE_HOME)/lib
LD_THIRD_LIB_NAME   += -lDtDsp   

TARGET_FILE_NAME = Dtdsp_Demo.out
TARGET 			 = ./$(TARGET_FILE_NAME)

all: $(TARGET)

$(TARGET):
	@echo $(LD_DTDSP_LIB_NAME)
	$(CPP) $(SRC) $(CFLAGS)  -o $(TARGET_FILE_NAME) -Wl,-Bdynamic -L./$(LD_THIRD_LIB_PATH) $(LD_THIRD_LIB_NAME) -Bstatic -L./$(LD_DTDSP_LIB_PATH) $(LD_DTDSP_LIB_NAME_S)
	
clean: 
	$(RM) $(TARGET) $(OBJS) 

